class Role < ActiveRecord::Base
	has_and_belongs_to_many :users
	has_many :permissions
	
	def permitted? object_name, operation_name
		permissions.detect do |permission|
			permission.allows? object_name, operation_name
		end != nil
	end
end